import java.io.Serializable;

public class Body_joint implements Comparable<Body_joint>, Serializable {
    private int x,y,dx,dy,s;
    public Body_joint(int x,int y)
    {
        this.x=x;
        this.y=y;
    }
    public Body_joint(int x,int y,int dx,int dy)
    {
        this.x=x;
        this.y=y;
        this.dx=dx;
        this.dy=dy;
    }
    public Body_joint(Body_joint body_joint)
    {
        this.x=body_joint.x;
        this.y=body_joint.y;
        this.s=body_joint.s;
        this.dx=body_joint.dx;
        this.dy=body_joint.dy;
    }
    public String toString()
    {
        return x+" "+y+" "+dx+" "+dy;
    }
    public int getX() {
        return x;
    }
    public int getY() {
        return y;
    }
    public int getDx() {
        return dx;
    }
    public int getDy() {
        return dy;
    }
    public int getS() {
        return s;
    }
    public void setX(int x) {
        this.x = x;
    }
    public void setY(int y) {
        this.y = y;
    }
    public void setDx(int dx) {
        this.dx = dx;
    }
    public void setDy(int dy) {
        this.dy = dy;
    }
    public void setS(int s) {
        this.s = s;
    }
    public boolean equals(Body_joint body_joint)
    {
        return this.x==body_joint.getX()&&this.y==body_joint.getY();
    }

    public int getDis(Body_joint body_joint)
    {
        return Math.abs(this.x-body_joint.x)+Math.abs(this.y-body_joint.y);
    }
    @Override
    public int compareTo(Body_joint o) {
        return this.s-o.s;
    }
}
